// 具体业务代码文件中
import http from "@/utils/http"; // 上一步封装axios的路径中

export const login = (params) => {
  return http({
    url: "/userInfo",
    method: "get",
    params,
  });
};

export const userInfoUpdate = (data) => {
  return http({
    url: "/userInfo/update",
    method: "post",
    data,
  });
};

export const unreadCount = (params) => {
  return http({
    url: "/messages/unreadCount",
    method: "get",
    params,
  });
};

export const messages = (params) => {
  return http({
    url: "/messages",
    method: "get",
    params,
  });
};

export const messagesInfo = (id) => {
  return http({
    url: `/messages/${id}`,
    method: "get",
  });
};

// 家长/老师回复
export const addReply = (data) => {
  return http({
    url: "/messages/addReply",
    method: "post",
    data,
  });
};

// 学生发生消息
export const sendMessage = (data) => {
  return http({
    url: "/messages/sendMessage",
    method: "post",
    data,
  });
};

export const getConversationID = (id) => {
  return http({
    url: `/getConversationID`,
    method: "get",
  });
};

export const chatContact = (data) => {
  return http({
    url: `/chatContact`,
    method: "post",
    data,
    responseType: "stream",
  });
};

export const getPlayUrl = (id) => {
  return http({
    url: `/getConversationID`,
    method: "get",
  });
};

export const prefish = (data) => {
  return http({
    url: `/preFish`,
    method: "post",
    data,
  });
};


export const report = (id) => {
  return http({
    url: `/report/${id}`,
    method: "get",
  });
};

export const reportList = () => {
  return http({
    url: `/report/reportsByOpenid`,
    method: "get",
  });
};

export const latestReport = () => {
  return http({
    url: `/report/latestReport`,
    method: "get",
  });
};

export const reportsByClass = (id) => {
  return http({
    url: `/report/reportsByClass/${id}`,
    method: "get",
  });
};

export const reportsStatisticsByClass = (id) => {
  return http({
    url: `/report/reportsStatisticsByClass/${id}`,
    method: "get",
  });
};
